Description:
CTCOC detects cases where the same variable is cast to several incompatible types, or a variable is cast to some type and then checked to be an instance of an incompatible type. In this case, incompatible means that two target classes are not related, i.e., neither class is derived from the other.
Incorrect:
function getLastChar(obj:TObject):char begin result := (obj as StringBuilder)((obj as StringBuffer).Length - 1); end;
Correct:
function getLastChar(obj:TObject):char begin result := (obj as StringBuffer)((obj as StringBuffer).Length - 1); end;